package com.morehair.controller.wx;

import com.morehair.bean.pojo.Storage;
import com.morehair.bean.vo.admin.BaseRespVo;
import com.morehair.service.admin.FileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.text.ParseException;

/**
 * @Author: DLX
 * @Date: 2021/6/8 14:29
 * @Description:
 **/

@RestController
@RequestMapping("wx/storage")
public class WxFileController {

    @Autowired
    FileService fileService;

    @RequestMapping("upload")
    public BaseRespVo fileUpload(@RequestParam("file") MultipartFile multipartFile) throws IOException, ParseException {

        Storage storage = fileService.fileUpload(multipartFile);
        return BaseRespVo.ok(storage);
    }
}
